.TH std::initializer_list::size 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::initializer_list::size \- std::initializer_list::size

.SH Synopsis
   size_type size() const noexcept;            \fI(since C++11)\fP
                                               \fI(until C++14)\fP
   constexpr size_type size() const noexcept;  \fI(since C++14)\fP

   Returns the number of elements in the initializer list, i.e. std::distance(begin(),
   end()).

.SH Parameters

   \fI(none)\fP

.SH Return value

   the number of elements in the initializer list

.SH Complexity

   Constant

.SH Example


// Run this code

 #include <initializer_list>
 int main() { static_assert(std::initializer_list{1,2,3,4}.size() == 4); }
